/**
 * Copyright (C) 2021 - 2031 O-Cubes Co., Ltd.
 */

/****************************************************************
 *  @file    syscounter.h
 *  @brief   SYSCOUNTER header file
 *  @version v1.0
 *  @date    03. Apr. 2023
 ****************************************************************/

#ifndef __SYSCOUNTER_H__
#define __SYSCOUNTER_H__

#include <stdint.h>
#include "hal/include/types.h"

#ifdef __cplusplus
extern "C" {
#endif

#define US_PER_MS                         (1000UL)
#define US_PER_SECOND                     (1000000UL)

typedef enum {
	SYSCNT_DISABLE = 0,
	SYSCNT_ENABLE,
} syscnt_ctrl;

void syscnt_init(void);
u64  syscnt_read_counter(void);
void syscnt_set_counter(u32 high, u32 low);
u64  syscnt_tick_to_usec(u64 tick);
void syscnt_udelay(u32 usec);
void syscnt_mdelay(u32 msec);
void syscnt_delay(u32 sec);

#ifdef __cplusplus
}
#endif

#endif /* __SYSCOUNTER_H__ */
